package com.own.business.question.common.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.own.business.question.common.base.ReplyEnvironment;

import java.io.IOException;

/**
 * AtTimeSerializer
 *
 * @author chenxueli
 * @date 2021/3/20 15:19
 */
public class ReplyEnvironmentSerializer extends JsonSerializer<ReplyEnvironment> {

    @Override
    public void serialize(ReplyEnvironment value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        if (value == null) {
            jsonGenerator.writeString("");
            return;
        }
        jsonGenerator.writeString(value.title());
    }

}
